# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=ktorrent
pkgver=24.02.2
pkgrel=1
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and riscv64 blocked by qt5-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://kde.org/applications/internet/org.kde.ktorrent"
pkgdesc="A powerful BitTorrent client for KDE"
license="GPL-2.0-or-later"
makedepends="
	boost-dev
	extra-cmake-modules
	karchive5-dev
	kcmutils5-dev
	kcompletion5-dev
	kconfig5-dev
	kconfigwidgets5-dev
	kcoreaddons5-dev
	kcrash5-dev
	kdbusaddons5-dev
	kdnssd5-dev
	kdoctools5-dev
	ki18n5-dev
	kiconthemes5-dev
	kio5-dev
	kitemviews5-dev
	knotifications5-dev
	knotifyconfig5-dev
	kparts5-dev
	kplotting5-dev
	kross-dev
	ktextwidgets5-dev
	kwidgetsaddons5-dev
	kwindowsystem5-dev
	kxmlgui5-dev
	libktorrent-dev
	phonon-dev
	plasma-workspace-dev
	qt5-qtbase-dev
	qt5-qtwebengine-dev
	samurai
	solid5-dev
	syndication5-dev
	taglib-dev
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/network/ktorrent.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/ktorrent-$pkgver.tar.xz"
subpackages="$pkgname-lang"

build() {
	# The infowidget plugin is disabled due to an incompatibility with musl
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DENABLE_INFOWIDGET_PLUGIN=FALSE
	cmake --build build
}

check() {
	cd build

	# ipblocklisttest requires itself installed
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "ipblocklisttest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d623cad02bf524795c514a859360e29a6608299a7327d43ba2e07f0520bd487c24c94f1aa17d5193454fb8b18059b79c27fa88e867f249e204b83f2c08f6e9a0  ktorrent-24.02.2.tar.xz
"
